package com.jyxd.web.controller.basic;

import com.jyxd.web.data.dto.HttpResult;
import com.jyxd.web.service.assessment.basic.BasicNursingSyncRecordService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping(value = "/basicNursingSync")
public class BasicNursingSyncRecordController {

    @Autowired
    private BasicNursingSyncRecordService basicNursingSyncRecordService;

    @ApiOperation("新增患者频次")
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    @ResponseBody
    public HttpResult saveBasicNursingSyncRecord(@RequestBody Map<String, Object> map) {
        return basicNursingSyncRecordService.saveBasicNursingSyncRecord(map);
    }

    @ApiOperation("查询患者频次数据")
    @RequestMapping(value = "/queryList", method = RequestMethod.POST)
    @ResponseBody
    public HttpResult findDataList(@RequestBody Map<String, Object> map) {
        return basicNursingSyncRecordService.findDataList(map);
    }

    @ApiOperation("根据频次自动新增基础护理逻辑（传code则单个新增，不传则批量新增）")
    @RequestMapping(value = "/syncNursing", method = RequestMethod.POST)
    @ResponseBody
    public HttpResult syncDataInNursing(@RequestBody Map<String, Object> map) throws IllegalAccessException {
        return basicNursingSyncRecordService.syncDataInNursing(map);
    }
}
